Vue.component('dong-show', {
	props: {
		info: {
			type: Object,
			required: true
		},
		open: {
			type: Boolean,
			required: true
		}
	},
	mounted() {
		console.log("info" + this.info.projets)
		console.log("open" + this.open)
	},
	watch: {
    info: {
      handler(newValue, oldValue) {
        console.log('info 变化了', newValue, oldValue);
      },
      deep: true // 监听对象内部属性的变化
    }
  },
	methods: {
		closeFrom() {
			this.open = false;
			this.$emit('type', this.open)
		},
		updateOrderInfoContent(){
			
			let _this = this;
			  
			$.ajax("/doctor/Order/updateOrderInfoContent", {
			    type: "POST",
			    data: {
					id:_this.info.id,
			        status: _this.info.status,
			       content:_this.info.reportContent,
			    },
			    success: function(data, textStatus) {
					
			        let datas = JSON.parse(data);
					console.log(datas)
			        if (datas.statusCode == 200) {
			           console.log(datas)
			            alert(datas.errMsg);
						location.reload();
			        } else {
						
			            alert(datas.errMsg)
			        }
			    }
			})
			
		
		},
	},
	template: `
	
	<div class="modal fade show" id="fromModal" style="max-height: 75%; overflow: auto;display:block" v-if="open">
		<div class="modal-dialog modal-lg" id="print">
			<div class="modal-content">
				<div class="modal-header">
					<h5 class="modal-title">审核体检项目结果</h5>
					<button type="button" class="btn-close" @click="closeFrom()"></button>
				</div>
				<div class="modal-body">
					<form class="comment-form" id="myForm">
						<div class="row">
							<div class="col-lg-3">
								<div class="mb-3">
									<label class="text-black font-w600 form-label">体检患者
										<span class="required">*</span></label>
									<input type="text" class="form-control" readonly id="realname" name="realname"
										placeholder="体检项目" style="border: 0;" :value="info.realName">
									<input type="hidden" class="form-control" readonly id="id" name="id" placeholder=""
										:value="info.id">
								</div>
							</div>
							<div class="col-lg-3">
								<div class="mb-3">
									<label class="text-black font-w600 form-label">身份证号
										<span class="required">*</span></label>
									<input type="text" class="form-control" readonly id="cardid" name="cardid"
										placeholder="身份证号" style="border: 0;" :value="info.cardId">
								</div>
							</div>
							<div class="col-lg-3">
								<div class="mb-3">
									<label class="text-black font-w600 form-label">体检单号
										<span class="required">*</span></label>
									<input type="text" class="form-control" readonly id="order_sn" name="order_sn"
										placeholder="体检单号" style="border: 0;" :value="info.orderSn">
								</div>
							</div>
							<div class="col-lg-3">
								<div class="mb-3">
									<label class="text-black font-w600 form-label"><span
											class="required">*总检审核状态</span></label>
									<select name="status" id="status" v-mode="info.status" class="form-control">
										<option value="0" :selected="info.status == 0">待总结</option>
										<option value="1" :selected="info.status == 1">总结中</option>
										<option value="2" :selected="info.status == 2">已总结</option>
									</select>
								</div>
							</div>
						</div>
						<hr class="hr">
	
						<div class="row">
							<div class="table-responsive row" style="text-align: center;" v-for="item in info.projects">
								<div class="col-lg-3">
									<div class="mb-3">
										<label class="text-black font-w600 form-label">检查项目
											<span class="required">*</span></label>
										<input type="text" class="form-control" readonly id="order_sn" name="order_sn"
											placeholder="检查项目" :value="item.projectName" style="border: 0;">
									</div>
								</div>
								<div class="col-lg-3">
									<div class="mb-3">
										<label class="text-black font-w600 form-label">检查科室
											<span class="required">*</span></label>
										<input type="text" class="form-control" readonly id="order_sn" name="order_sn"
											placeholder="检查科室" :value="item.subjectName" style="border: 0;">
									</div>
								</div>
								<div class="col-lg-3">
									<div class="mb-3">
										<label class="text-black font-w600 form-label">检查医生
											<span class="required">*</span></label>
										<input type="text" class="form-control" readonly id="order_sn" name="order_sn"
											placeholder="检查医生" :value="item.doctorName" style="border: 0;">
									</div>
								</div>
								<div class="col-lg-3">
									<div class="mb-3">
										<label class="text-black font-w600 form-label">检查状态
											<span class="required">*</span></label>
										<input type="text" class="form-control" readonly id="order_sn" name="order_sn"
											placeholder="检查状态" :value="item.status" style="border: 0;">
									</div>
								</div>
								<table class="table table-responsive-md" v-if="item.targets && item.targets.length >0">
									<thead>
										<tr>
											<th>名称</th>
											<th>参考值</th>
											<th>参数</th>
										</tr>
									</thead>
									<tbody>
										<tr v-for="row in item.targets">
											<td>{{row.targetName}}</td>
											<td>{{row.targetMin}} -{{row.targetMax}}
											</td>
											<td>{{row.targetNum}}</td>
										</tr>
									</tbody>
								</table>
								<div class="col-lg-12">
									<div class="mb-3">
										<label class="text-black font-w600 form-label">科室小结
											<span class="required">*</span></label>
										<textarea rows="3" class="form-control"
											style="border:0px" >{{item.subjectContent}}</textarea>
									</div>
	
								</div>
								<hr class="hr">
							</div>
						</div>
						
						<div class="mb-3">
							<label
								class="text-black font-w600 form-label">总检结论
								<span class="required">*</span></label>
							<textarea rows="3" class="form-control" v-model="info.reportContent" name="content" id="content">{{info.reportContent}}</textarea>
						</div>
	
						<div class="col-lg-12 text-center">
							<button type="button" class="btn btn-outline-primary"
								@click="updateOrderInfoContent()">提交</button>
						</div>
					</form>
				</div>
			</div>
		</div>
	</div>
	`
})